package com.rightsidetech.system.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.rightsidetech.commom.base.ResponseData;
import com.rightsidetech.system.dtos.request.OperatorLogReq;
import com.rightsidetech.system.dtos.response.ModifyLogNameResp;
import com.rightsidetech.system.dtos.response.OperatorLogResp;
import com.rightsidetech.system.mapper.SysAgentOperatorLogMapper;
import com.rightsidetech.system.service.SysAgentOperatorLogService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author: yhr
 * @Date: 2021-11-18 14:27
 */
@Service("sysAgentOperatorLogServiceImpl")
public class SysAgentOperatorLogServiceImpl implements SysAgentOperatorLogService {
    @Resource
    private SysAgentOperatorLogMapper sysAgentOperatorLogMapper;

    @Override
    public ResponseData<PageInfo<OperatorLogResp>> page(OperatorLogReq req, Long agentId) {
        PageHelper.startPage(req.getPageNo(), req.getPageSize());
        List<OperatorLogResp> list = sysAgentOperatorLogMapper.page(req, agentId);
        return ResponseData.success(new PageInfo<>(list));
    }

    @Override
    public ResponseData selectList() {
        List<ModifyLogNameResp> logNameResps = sysAgentOperatorLogMapper.selectList();
        return ResponseData.success(logNameResps);
    }
}
